<?php
// +------------------------------------------------------------------------------	
//	@desc Load And Initialize For Core File
//  @date Wed Aug 19 CST 2009
//  @author Fly Jin <flysharping@gamil.com>
// +------------------------------------------------------------------------------	
	function __autoload($obj) {
		include_once($obj.'.php');
	}

	//Use Another Model ---------------------------------------------------------
	function loadModel($modelName) {
		global  $db;
		$modelClass = $modelName;
		$file = PATH_MODEL.$modelClass.'.php';
		if (file_exists($file)) {
			include_once($file);
			$model = new $modelClass();
			$model->db = $db;
		}else{
			$model = false;
		}
		return $model;
	}	

	//Use Another Controller ------------------------------------------------------
	function loadController($controlName) {
		$controlClass = $controlName.'Controller';
		$file = PATH_CONTROLLER.$controlClass.'.php';
		if (file_exists($file)) {
			include_once($file);
			$control = new $controlClass();
		}else{
			$control = false;
		}
		return $control;
	}

?>